import { IFeidaoAiWeappPage } from '@dfeidao/atom-wxapp/interfaces';
import get_local from '@dfeidao/atom-wxapp/local/get';
import get_global from '@dfeidao/atom-wxapp/global/get';
import show_modal from '@dfeidao/atom-wxapp/api/interaction/show-modal';
import showLoadling from '@dfeidao/atom-wxapp/api/interaction/show-loading';
import hideLoadling from '@dfeidao/atom-wxapp/api/interaction/hide-loading';
import execute from '@dfeidao/atom-wxapp/msg/execute';
// import { send_msg as url, spaceid, systemid } from '../atom/config';
import { spaceid, systemid } from '../atom/config';
import a008 from './a008';

export default async function a007(fd: IFeidaoAiWeappPage, e: {
	detail: {
		value: string;
	}
}) {
	// todo
	showLoadling('过账中');
	const userInfo = get_global('userinfo') as any;
	try {
		const aaa = await execute('self_sell-model-supplement_order-0001_2.1', {
			param: {
				doccode: get_local(fd, 'doccode'),
				stepno: "100",
				pageno: "outbound",
				root_table: "supplement_order"
			}
		}, userInfo.usercode, spaceid, systemid, 0, '6641');
		console.log(aaa, '------过账中-------');

		a008(fd);// 推送
		// debugger
	} catch (error) {
		hideLoadling();
		const succ = await show_modal('过账失败', error.errMsg.toString());
		if (succ.msg.confirm) {
			console.log('用户点击确定')
		} else if (succ.msg.cancel) {
			console.log('用户点击取消')
		}
	}
}
